package cc.inik.goodsquery;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import com.nle.mylibrary.forUse.rfid.RFID;

public class MainActivity2 extends AppCompatActivity {

    private TextView epc_code;
    private Button save;
    private EditText product_n;
    private EditText product_p;
    private String epc;
    private Intent intent;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        this.bindView();
        this.intent = getIntent();
        Bundle bundle = this.intent.getExtras();
        this.epc = bundle.getString("epc");
        this.epc_code.setText(epc);
        save.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Bundle bundle = new Bundle();
                bundle.putString("epc",epc);
                bundle.putString("product_name",product_n.getText().toString());
                bundle.putString("product_price",product_p.getText().toString());
                intent.putExtras(bundle);
                setResult(0x01,intent);
                finish();
            }
        });
    }
    private void bindView(){
        this.epc_code = findViewById(R.id.epc_code);
        this.save = findViewById(R.id.save);
        this.product_n = findViewById(R.id.product_n);
        this.product_p = findViewById(R.id.product_p);
    }
}